import unittest
from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.testing import ExportImportZCMLLayer
from ely.maildrophostmonster.mailhost import MaildropHostMonster
import ely.maildrophostmonster.exportimport
from Products.Five import zcml


MAILHOST_XML = '''<?xml version="1.0"?>
<object name="MailHost" meta_type="Maildrop Host Monster"/>
'''


class MailHostAdapterTests(BodyAdapterTestCase):

    layer = ExportImportZCMLLayer

    def _getTargetClass(self):
        from ely.maildrophostmonster.exportimport.mailhost \
                import MailHostAdapter
        return MailHostAdapter

    def setUp(self):
        zcml.load_config('configure.zcml',
                         ely.maildrophostmonster.exportimport)
        BodyAdapterTestCase.setUp(self)
        self._obj = MaildropHostMonster('MailHost')
        self._BODY = MAILHOST_XML


def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(MailHostAdapterTests),
        ))
